home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / General / ViewIt™ 2.24 Shareware / About Compilers / About Compilers.rsrc / TEXT_1012_CS2. Numbers.txt < prev    next >
Text File  |  1994-03-03  |  3KB  |  39 lines

  1. Numbers
  2. Numerical (Data) Types  To work properly with most FaceWare modules, a compiler must support numbers based on the IEEE or SANE format.  This requirement is met for all of the compilers that we directly support, but each language has its own way of naming these numerical types that does not always make clear the number of bytes used by each type.  Moreover, different compilers supporting the same language may not even agree on type names!  The following table should help prevent any confusion.  The numbers 1 to 12 are sometimes passed to FaceWare modules to indicate the "data type" of variables.
  3.  
  4. Numerical Type       C,C++     FORTRAN       Pascal
  5. 1. 1-byte integer    char      integer*1     signedByte
  6. 2. 2-byte integer    short     integer*2     integer
  7. 3. 4-byte integer    long      integer*4     longint
  8. 4. 8-byte integer    comp      comp          computational
  9. 5. 4-byte real      float      real*4        real
  10.  
  11. 6. 8-byte real   double(WC)     real*8       double(LP,WP)
  12.                  short double(LC,MC)         double(MP)‚Ć
  13.                  double(SC,MC)‚Ć
  14.  
  15. 7. 10-byte real  extended(WC)   real*10(LF)  extended(LP,WP)
  16.    w/o 68881     long double(LC)*            double(MP)‚Ć‚Ć
  17.                  long double(SC,MC)
  18.                  double(SC,MC)‚Ć‚Ć
  19.  
  20. 8. 12-byte real  extended(WC)   real*12      extended(LP,WP)
  21.    w/ 68881      long double(LC)*            double(MP)‚Ć‚Ć
  22.                  long double(SC,MC)
  23.                  double(SC,MC)‚Ć‚Ć
  24.  
  25. 12.12-byte real  long double(LC)**
  26.  
  27. ‚Ć if "8-byte doubles" on
  28. ‚Ć‚Ć if "8-byte doubles" off
  29. * if "Native FP" on
  30. ** if "Native FP" off  (THINK C "universal")
  31.  
  32. Array Types  Some modules require programmers to specify the data type of arrays.  This data type is a combination of one of the integers 1 to 12 from the above table, plus a "block type" given by the sign of this integer.  The block type refers to how the numbers in a two-dimensional array are arranged in memory relative to "rows" and "columns" displayed or used by the module.  Positive block types (+1 to +12) indicate that the array consists of blocks of rows (R1C1, R1C2, R1C3... are contiguous), and negative block types (-1 to -12) indicate that the array consists of blocks of columns (R1C1, R2C1, R3C1... are contiguous in memory).
  33.   Determining the proper block type (the sign of the data type) to pass to a module depends on which index of the 2-dimensional array corresponds to rows vs. columns, and the language in use.  For example, given a real*8 FORTRAN array dimensioned as "myArray(10,5)" and an equivalent C or Pascal array also dimensioned as "myArray[10,5]", the data type passed to a module could be either ¬±6:
  34.   non-FORTRAN  "myArray[10,5]" = 10 blocks of 5 numbers each:
  35.       ‚Ä¢ use "+6" to denote 10 rows of 5 columns each
  36.       ‚Ä¢ use "-6" to denote 10 columns of 5 rows each
  37.   vs. FORTRAN  "myArray(10,5)" = 5 blocks of 10 numbers each:
  38.       ‚Ä¢ use "+6" to denote 5 rows of 10 columns each
  39.       ‚Ä¢ use "-6" to denote 5 columns of 10 rows each